<script charset="utf-8" src="/public/assets/sysadmin/mylzp/KindEditor/kindeditor-min.js"></script>
<script charset="utf-8" src="/public/assets/sysadmin/mylzp/KindEditor/lang/zh_CN.js"></script>
<script charset="utf-8" src="/public/assets/sysadmin/mylzp/KindEditor/php/upload_json.php"></script>
<script>
    var editor;
    KindEditor.ready(function(K) {
        editor = K.create('textarea[name="contentTxet"]', {
                allowFileManager : true,
                afterBlur: function(){this.sync();}
        });
    }); 
</script>
<div id="main">
    <div class="container-fluid">
        <div class="page-header">
        	<div class="pull-left">
        		<h1>cms文章管理</h1>
        	</div>
        	<div class="pull-right">
        		<ul class="stats">
        			<li class='lightred'>
        				<i class="icon-calendar"></i>
        				<div class="details">
        					<span class="big"></span>
        					<span></span>
        				</div>
        			</li>
        		</ul>
        	</div>
        </div>
        <div class="breadcrumbs">
        	<ul>
        		<li>
        			<a href="javascript:void(0);">后台管理</a>
        			<i class="icon-angle-right"></i>
        		</li>
        		<li>
        			<a href="javascript:void(0);">cms管理</a>
        			<i class="icon-angle-right"></i>
        		</li>
        		<li>
        			<a href="javascript:void(0);"><?=empty($id)?'添加文章':'修改文章'?></a>
        		</li>
        	</ul>
        	<div class="close-bread">
        		<a href="#"><i class="icon-remove"></i></a>
        	</div>
        </div>
    
        <div class="row-fluid">
        	<div class="span12">
        		<div class="box box-color box-bordered">
        			<div class="box-title">
        				<h3>
        					<i class="icon-user">
                                <?=empty($id)?'添加文章':'修改文章'?>
                            </i>
        				</h3>
        			</div>
        			<div class="box-content nopadding">
                        <form  class='form-horizontal form-bordered form-validate' action='<?=$this->url("cms/infoEdit")?>'  id="login" name="bb" method='post'>
        					<div class="control-group">
        						<label class="control-label">标题</label>
        						<div class="controls">
        							<input type="text" name="data[title]" id="title" value="<?=empty($result)?'':$result['title']?>" class="input-xlarge" data-rule-required="true" data-rule-minlength="2">
        						</div>
        					</div>
                            <div class="control-group">
        						<label class="control-label">所属分类</label>
        						<div class="controls">
                                    <select name="data[modelid]" class="input-xlarge">
                                    <?
                                    if(!empty($model)){
                                        foreach($model as $k=>$v){?>
                                            <option value="<?=$v['id']?>" <?=!empty($result)&&$result['modelid']==$v['id']?'selected':''?> ><?=$v['title']?></option>
                                        <?}
                                    }
                                    ?>
                                    </select>
                                </div>
        					</div>
                            <div class="control-group">
                                <label for="textfield" class="control-label">背景图</label>
                                <div class="controls">
                                    <div class="fileupload fileupload-new" data-provides="fileupload">
                                        <div class="fileupload-new thumbnail"><img src="<?=!empty($result) ? $result['imgurl'] : ''?>" style="max-width: 400px;max-height: 200px;" /></div>
                                        <div class="fileupload-preview fileupload-exists thumbnail" style="max-width: 400px;max-height: 200px;"></div>
                                        <div>
                                            <span class="btn btn-file"><span class="fileupload-new">浏览</span><span class="fileupload-exists">重选</span>
        									<input type="file" name='imgurl' />
        									</span>
                                            <a href="#" class="btn fileupload-exists" data-dismiss="fileupload">移除</a>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="control-group">
                                <label for="textfield" class="control-label">图标</label>
                                <div class="controls">
                                    <div class="fileupload fileupload-new" data-provides="fileupload">
                                        <div class="fileupload-new thumbnail"><img src="<?=!empty($result) ? $result['imgicon'] : ''?>" style="max-width: 85px;max-height: 85px;" /></div>
                                        <div class="fileupload-preview fileupload-exists thumbnail" style="max-width: 85px;max-height: 85px;"></div>
                                        <div>
                                            <span class="btn btn-file"><span class="fileupload-new">浏览</span><span class="fileupload-exists">重选</span>
        									<input type="file" name='imgicon' />
        									</span>
                                            <a href="#" class="btn fileupload-exists" data-dismiss="fileupload">移除</a>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="control-group">
                                <label for="textfield" class="control-label">文档</label>
                                <div class="controls">
                                    <div class="fileupload fileupload-new" data-provides="fileupload">
                                        <div class="fileupload-new thumbnail"><?=!empty($result) ? $result['texturl'] : ''?></div>
                                        <div class="fileupload-preview fileupload-exists thumbnail" ></div>
                                        <div>
                                            <span class="btn btn-file"><span class="fileupload-new">浏览</span><span class="fileupload-exists">重选</span>
        									<input type="file" name='texturl' />
        									</span>
                                            <a href="#" class="btn fileupload-exists" data-dismiss="fileupload">移除</a>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="control-group">
        						<label class="control-label">简介</label>
        						<div class="controls">
                                    <textarea class="input-xlarge" name="data[briefing]"><?=empty($result)?'':$result['briefing']?></textarea>
                                </div>
        					</div>
                            <div class="control-group">
        						<label class="control-label">内容</label>
        						<div class="controls">
                                    <textarea class="input-xlarge" name="contentTxet" style="height: 300px;width: 700px;"><?=empty($result)?'':$result['contentTxet']?></textarea>
                                </div>
        					</div>
                            <div class="control-group">
        						<label  class="control-label">状态</label>
        						<div class="controls">
        							<select name="data[status]" id="status" class="input-xlarge">
                                        <option value="1" <?=!empty($result)&&$result['status']==1?'selected':''?>>正常</option>
                                        <option value="2" <?=!empty($result)&&$result['status']==2?'selected':''?>>冻结</option>
                                    </select>
        						</div>
        					</div>
        					<div class="form-actions">
                                <input type="hidden" name="id" value="<?=empty($id)?0:$id?>" />
        						<input type="submit" id="edit" class="btn btn-primary show_shadefrist" value="<?=empty($id)?'添加':'修改'?>" />
                                <input type="reset" class="btn btn-primary" value="重置" />
                                <input type="button" id="frist" class="btn btn-primary" value="返回" />
        					</div>
        				</form>
        			</div>
        		</div>
        	</div>
        </div>
    </div>
</div>
<script>
    $(document).ready(function(){
        $('#frist').click(function(){
            window.location.href="/index.php/sysadmin/cms/info";
        })
    })
</script>